App.require(function () {
    var app = App.getCurrent();
    app.defineComponent("vi-fillelement", {
        getDomObj: function () {
            this.attachDom("input", "input")
                .attachEvent("input", "input", this.inputHandler, false)
        },
        inputHandler: function (ev) {
            this.dispatchCustomEvent("inputChange", {
                component: this,
                value: ev.target.value,
                key: this.dataset.key,
                value: this.value,
                behavior: this.dataset.target
            });
        },
        render: function (next) {
            var obj = JSON.parse(this.dataset.element);
            for (var key in obj) {
                this.property[key] = obj[key];
            }
            this.fetch("index.html", function (text) {
                return next(this.renderHTML(text));
            });
        },
        get value() {
            return this.domList.input.value;
        },
        set value(val) {
            this.domList.input.value = val;
        }
    });
});